package com.ctrl.riveradministrator.mvp.view.activity.suggest;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseListAdapter;
import com.ctrl.riveradministrator.base.BaseViewHolder;
import com.ctrl.riveradministrator.common.Constants;
import com.ctrl.riveradministrator.mvp.model.Bulletin;
import com.ctrl.riveradministrator.mvp.model.Suggest;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.drawable.ProgressBarDrawable;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;

public class SuggestAdapter extends BaseListAdapter<Suggest> {

    private Context context;
    private TextView suggestManager, status, suggestName;
    private RelativeLayout content;
    private ImageView imageView;

    public SuggestAdapter(Context mContext) {
        super(mContext);
        this.context = mContext;
    }

    @Override
    public int getLayoutId() {
        return R.layout.bullentin_item;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public void onBindItemHolder(BaseViewHolder holder, int position) {
        suggestManager = holder.getView(R.id.bulletin_name_tv);
        status = holder.getView(R.id.phone_tv);
        suggestName = holder.getView(R.id.people_tv);
        imageView = holder.getView(R.id.level_iv);
        content = holder.getView(R.id.content);

        Suggest suggest = getDataList().get(position);

        suggestManager.setText(suggest.getSuggestManager());
        if (suggest.getStatus().equals("2"))
            status.setText("未处理");
        else
            status.setText("已处理");
        suggestName.setText(suggest.getSuggestName());
        imageView.setVisibility(View.INVISIBLE);
        content.setOnClickListener(v -> mOnItemClickListener.onItemClick(suggest, position));
    }


}
